#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

// 向文件中写入二进制数据
// 写入数据块文件函数 fwrite()

int main()
{

    FILE *fp;
    int i, arr[5];

    arr[0] = 100;
    arr[1] = 200;
    arr[2] = 300;
    arr[3] = 400;
    arr[4] = 500;

    fp = fopen("./test-p2.txt", "wb+");
    if (fp == NULL)
    {
        printf("open file fail");
        exit(0);
    }

    fwrite(arr, sizeof(int), 5, fp);
    fclose(fp);

    return 0;
}
